

define(function(require,exports,module){

	
	
	function Main(jqObj,loadParams){
		var self = this;
		var columns = [[
			{field:'orgParentName',title:'上级名称',editor:{required:true}},
			{field:'orgAllName',title:'机构全称',width:360,align:"left",editor:{required:true}},
			{field:'orgShortName',title:'机构简称',editor:{}},
			{field:'orgTypeName',title:'机构类型',editor:{required:true}},
			{field:'orgCode',title:'部门代码',editor:{}},
			{field:'orgPhone',title:'联系电话',editor:{}},
			{field:'orgId',title:'机构ID',hidden:true},
			{field:'orgCount',title:'编制人数',editor:{}},
			{field:'orgLng',title:'经度',editor:{}},
			{field:'orgLat',title:'纬度',editor:{}},
		]];
		var formDialog = {
			title:'部门',
			width:400,
			height:360,
			formEx:{
				onLoad:function(){
					var jqForm = $(this);
					jqForm.findJq("orgParentName").textbox("disable");
					jqForm.findJq("orgAllName").textbox("disable");
					jqForm.findJq("orgShortName").textbox("disable");
					jqForm.findJq("orgTypeName").textbox("disable");
					jqForm.findJq("orgCode").textbox("disable");
				},
				url:'sys/fireorg/save.do'
			}
		}
	
		var MainUI = {
			eName:'datagrid',
			idField:'orgId',
			url:'sys/fireorg/json.do',
			delUrl:'sys/fireorg/del.do',
			queryParams:{orgType:3},
			columns:columns,
			formDialog:formDialog,
			onBeforeDel:function(row){
				$ui.alert('数据已经使用，不能删除!');
				return false;
			},
			toolbarEx:[null,{
				eName:'linkbutton',
				uId:'modify',
				text:'修改',
				plain:true,
				iconCls:'icon-Modify_Pwd'
			},{
				eName:'combobox',
				width:100,
				editable:false,
				value:'3',//默认值
				panelHeight:'auto',
				data:[{value:3,text:"大队"},{value:4,text:"中队"}],
				onChange:function(newValue, oldValue){//combobox事件
					self.jqGrid.datagrid('load',{'orgType':newValue});
				}
			}]
		}
		jqObj.createUI(MainUI);
		self.jqGrid = jqObj.findJq('datagrid');
	}
	module.exports = Main;

});
